<template>
  <div class="examine-container">
    <Promised :promise="getOrdersAsync">
      <template v-slot:pending>
        <CardSkeleton title="逾期订单" />
      </template>
      <template v-slot>
        <!-- this.$router.push({
        name: 'BeOverdueContent',
        params: { tid, oid },
      }) -->
        <OrderCard
          title="逾期订单"
          hide-money
          :pagination="pagination"
          type=""
          tips="已逾期"
          @more="handlerMore"
          @details="handlerDetails"
        />
      </template>
    </Promised>
  </div>
</template>

<script>
import { getRepaymentTasks } from '@/api/flow/work'
import props from './props'

export default {
  mixins: [props],

  computed: {
    tableParams () {
       // type 模块 [待还0 已还1 逾期2]
      const { per_page, page } = this.pagination
      return [5, page, { type: 2 }]
    },
  },

  methods: {
    tableHooksRequest () {
      return new Promise((resolve, reject) => {
        this.getTableDatas(getRepaymentTasks, this.tableParams)
          .then(data => {
            resolve(data)
          })
          .catch(error => {
            reject(error)
          })
      })
    },

    // 详情
    handlerDetails ({ task_id: tid, order_id: oid }) {
      this.$router.push({
        name: 'BeOverdueContent',
        params: {
          tid, oid,
        },
      })
    },

    // 更多
    handlerMore () {
      this.$router.push({
        name: 'BeOverdue',
      })
    },
  },
}
</script>
